import request from '@/utils/request'

// api地址
const api = {
	tiku_list: 'dati.rooms/tiku_list',
	game_info: 'dati.rooms/game_info',
	detail:'dati.rooms/detail',
	getUserAnswer: 'dati.rooms/get_game_tiku_detail',
	add: 'dati.rooms/createRoom',
	join: 'dati.rooms/join',
	logout: 'dati.rooms/logout',
	add_tiku: 'dati.rooms/add_tiku',
	update_tiku: 'dati.rooms/update_tiku',
	update_tiku_no: 'dati.rooms/update_tiku_no',
	getResult: 'dati.rooms/getResult',
	getUserList: 'dati.rooms/getUserList',
	getRankList: 'dati.rooms/getRankList',
}

export function getResult(id) {
	return request.get(api.getResult, {
		id
	})
}
export function detail(param) {
	return request.get(api.detail, param)
}
export function getRankList(param) {
	return request.get(api.getRankList, param)
}
export function getUserList(param) {
	return request.get(api.getUserList, param)
}

export function tiku_list(param, option) {
	return request.get(api.tiku_list, param, option)
}
export function getUserAnswer(param, option) {
	return request.get(api.getUserAnswer, param, option)
}

export function game_info(param, option) {
	return request.get(api.game_info, param, option)
}
export const add_tiku = (data) => {
	return request.post(api.add_tiku, {
		form: data
	})
}
export const join = (data) => {
	return request.post(api.join, {
		form: data
	})
}
export const logout = (data) => {
	return request.post(api.logout, {
		form: data
	})
}
export const add = (data) => {
	return request.post(api.add, {})
}
export const update_tiku = (data) => {
	return request.post(api.update_tiku, {
		form: data
	})
}
export const update_tiku_no = (data) => {
	return request.post(api.update_tiku_no, {
		form: data
	})
}